package xjggb.algorithm.排序.sort.insert;

import xjggb.algorithm.排序.sort.Sort;

/*
* 插入排序
* */
public class InsertSort1<T extends Comparable<T>> extends Sort<T> {
    @Override
    protected void sort() {
        /*
        * 插入排序
        * */
        for (int begin = 1; begin < array.length; begin++) {
            int cur = begin;
            while (cur>0 && cmp(cur,cur-1)<0){
                swap(cur,cur-1);
                cur--;
            }
        }
    }
}
